#ifndef OBJECT_H
#define OBJECT_H

#include "SDL2/SDL.h"

struct Object
{
    SDL_Texture* texture = nullptr;
    SDL_FPoint position = {0,0};
    int width = 0;
    int height = 0;
    int speed = 100;
    SDL_FPoint direction = {0, 0};

    SDL_FPoint getCenter() {
        SDL_FPoint center = {0, 0};
        center.x = position.x + width/2;
        center.y = position.y + height/2;
        return center;
    }
    SDL_Rect getRect() {
        SDL_Rect rect = {
            static_cast<int>(position.x),
            static_cast<int>(position.y),
            width,
            height,
        };
        return rect;
    }
};

struct Plane : public Object
{
    int currentHealth = 1;
    Uint32 coolDown = 1000;
    Uint32 lastShootTime = 0;
};


struct Player : public Plane
{
    int speed = 1000;
    Uint32 coolDown = 50;
    int currentHealth = 20;
    int maxHealth = 20;
};

struct Enemy : public Plane
{
};

struct Projectile : public Object
{
    int speed = 200;
    int damage = 1;
};

struct ProjectilePlayer : public Projectile
{
    int speed = 2000;
};

struct ProjectileEnemy : public Projectile
{
};

struct Explosion : public Object
{
    int currentFreme = 0;
    int totalFrame = 0;
    Uint32 startTime = 0;
    Uint32 FPS = 10;
};

enum class ItemType {
    Life,
    Shield,
    Time,
};

struct Item : public Object
{
    int speed = 200;
    ItemType type = ItemType::Life;
    int bounceCount = 3;
};

struct Background : public Object
{
    int speed = 30;
    float offset = 0;
};

#endif